/*! \file
 * \brief Enter a brief description here.
 *
 * Enter a detailed description here. (optional)
 * \author Author (Ivo Wingelaar)
 * \date Date (2011)
 * \version Version (0.0.1)
 * \copyright Copyright (GNU LGPL v3)
 */

#include "LynxTimeManagerLinux_C.hpp"

#ifdef _LYNX_LINUX_

#include <stdio.h>
#include <time.h>
#include <sys/time.h>

namespace Lynx
{

/** default constructor **/
TimeManagerLinux_C::TimeManagerLinux_C()
{
    init_timer();
}

/** default destructor **/
TimeManagerLinux_C::~TimeManagerLinux_C()
{
    //
}

/** virtual function **/
/** init_timer       **/
//! Initializes the timer.
/// \return void
/// \param  void
void TimeManagerLinux_C::init_timer(void)
{
    init_virtual_timer();
}

/** const virtual function **/
/** get_real_time          **/
//! Returns the real time, depends on implementation.
/// \return uint32_t
///         The real time.
/// \param  void
uint32_t TimeManagerLinux_C::get_real_time(void) const
{
    timespec ts;

    clock_gettime(CLOCK_MONOTONIC, &ts);
    return (uint32_t)ts.tv_sec * 1000LL + (uint32_t)ts.tv_nsec / 1000000LL;
}

} // namespace Lynx

#endif // _LYNX_LINUX_
